//
//  OperationLog.h
//  Guazi
//
//  Created by koolearn on 11-6-18.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "OperationLogFilter.h"
#import "Statement.h"

#define kOperationLogStatusLocal 0
#define kOperationLogStatusSuccess 1
#define kOperationLogStatusFail 2

#define kOperationLogModuleGroup @"Group"
#define kOperationLogModulePerson @"Contact"
#define kOperationLogModuleCard @"Card"

#define kOperationLogOperationAdd @"Add"
#define kOperationLogOperationEdit @"Modify"
#define kOperationLogOperationDelete @"Delete"

#define kOperationLogOperationAddPersonToGroup @"AddPersonToGroup"
#define kOperationLogOperationDeletePersonFromGroup @"DeletePersonFromGroup"

#define kOperationLogOperationSetPersonGroups @"ResetGroup"

#define kOperationLogOperationDeleteFriendCard @"DeleteFriendCard"


@interface OperationLog : NSObject {
    
    long long logId;
    long long userId;
    NSString* module;
    NSString* operation;
    NSString* refId;
    long long createAt;
    NSString* params;
    NSInteger status;
    long long uploadTime;
    NSInteger uploadCount;
    
}


@property (nonatomic, assign) long long logId;
@property (nonatomic, assign) long long userId;
@property (nonatomic, retain) NSString* module;
@property (nonatomic, retain) NSString* operation;
@property (nonatomic, retain) NSString* refId;
@property (nonatomic, assign) long long createAt;
@property (nonatomic, retain) NSString* params;
@property (nonatomic, assign) NSInteger status;
@property (nonatomic, assign) long long uploadTime;
@property (nonatomic, assign) NSInteger uploadCount;


- (id) initWithStatement:(Statement*)stmt;
- (id) initWithModule:(NSString*)module operation:(NSString*)op refId:(NSString*)r params:(NSString*)p;
- (NSString*) toString;

- (void) insert;
+ (NSArray*) select:(OperationLogFilter*)filter;
+ (NSArray*) selectForUpload:(NSInteger)maxUploadCount offset:(NSInteger)offset limit:(NSInteger)limit;
+ (void) updateResult:(BOOL)result logId:(long long)logId;

@end
